﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace T.S.BaseData.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class _20250822 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "HealthMessage",
                table: "CultivationInfo");

            migrationBuilder.RenameColumn(
                name: "SlaughterId",
                table: "SlaughteringEnterprises",
                newName: "GoodsId");

            migrationBuilder.RenameColumn(
                name: "ProcessingId",
                table: "ProcessingCompany",
                newName: "GoodsId");

            migrationBuilder.RenameColumn(
                name: "CultivationId",
                table: "EnterpriseInfo",
                newName: "GoodsId");

            migrationBuilder.CreateTable(
                name: "Health",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    HealthDays = table.Column<int>(type: "int", nullable: false),
                    HealthWay = table.Column<int>(type: "int", nullable: false),
                    HealthMethod = table.Column<int>(type: "int", nullable: false),
                    GoodsId = table.Column<int>(type: "int", nullable: false),
                    IsDelete = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Health", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Health");

            migrationBuilder.RenameColumn(
                name: "GoodsId",
                table: "SlaughteringEnterprises",
                newName: "SlaughterId");

            migrationBuilder.RenameColumn(
                name: "GoodsId",
                table: "ProcessingCompany",
                newName: "ProcessingId");

            migrationBuilder.RenameColumn(
                name: "GoodsId",
                table: "EnterpriseInfo",
                newName: "CultivationId");

            migrationBuilder.AddColumn<string>(
                name: "HealthMessage",
                table: "CultivationInfo",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");
        }
    }
}
